package com.yami.shop.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yami.shop.bean.model.Blog;
import com.yami.shop.bean.model.Comment;
import com.yami.shop.bean.vo.CommentMannageVo;
import com.yami.shop.common.util.PageParam;

import java.util.List;
import java.util.Map;

public interface CommentService extends IService<Comment> {

    IPage<CommentMannageVo> getAdminAllCommentList(PageParam<CommentMannageVo> page, CommentMannageVo commentMannageVo);
    List<CommentMannageVo> getAdminAllCommentList(CommentMannageVo commentMannageVo);

    void getToCommentList(Comment comment, List<Comment> commentList, List<Comment> resultList);
    List<Comment> getCommentReplys(List<Comment> list, Map<Long, List<Comment>> toCommentListMap);

    /**
     *  查询热评
     *
     * @param blogId
     * @param limit
     * @param hotLimit
     * @return
     */
    List<Comment> getHotComment(Long blogId, String userId, Integer limit, Integer hotLimit);

    /**
     *  通过用户id、商品id以及收藏类型删除数据
     *
     * @param userId
     * @param type
     * @param ids
     */
    void deteleByUserIdAndProdId(String userId, String type, List<Long> ids);

    /**
     *  通过博客id查询点赞列表，配置缓存
     *
     * @param blogId
     * @return
     */
    List<Comment> findUpvoteByBlogId(Long blogId);

    /**
     *  通过博客id查询评论列表，配置缓存
     *
     * @param blogId
     * @return
     */
    List<Comment> findCommentByBlogId(Long blogId);

    /**
     *  清空所有缓存
     *
     * @param blogId
     */
    void deleteAllCacheable(Long blogId);

    /**
     *  清空点赞缓存
     *
     * @param blogId
     */
    void deleteUpvoteCacheable(Long blogId);

    /**
     *  清空评论缓存
     *
     * @param blogId
     */
    void deleteCommentCacheable(Long blogId);

    /**
     *  查询用户历史个人点赞记录
     *
     * @param page
     * @param currentId
     * @param content
     * @return
     */
    IPage<Blog> pagePraiseUserBrowseHistory(PageParam<Blog> page, String currentId, String content);
}
